from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

class BasePage(object):
    url = None
    driver = None

    def __init__(self, driver):
        self.driver = driver

    def find_element(self, *loc):
        try:
            wait = WebDriverWait(self.driver, 10, 0.5)
            return wait.until(EC.presence_of_element_located(loc))
        except:
            print("元素定位在页面中无法找到！", loc)
        finally:
            pass

    def get_titleContent(self):
        return self.driver.title


